Communication apparatus, method for controlling the same, and storage medium

ABSTRACT

A communication apparatus starts short distance wireless communication with another communication apparatus while joining a wireless LAN created by an external access point (AP) as a station, determines whether the communication apparatus can concurrently perform a station function and an AP function of the wireless LAN in accordance with the start of the short distance wireless communication, directly connects to the other communication apparatus by the wireless LAN by disconnecting from the external AP when it is not determined that the station function and the AP function can be concurrently performed, reconnects to the external AP as the station when the direct connection fails, and directly connects to the other communication apparatus by the wireless LAN without disconnecting from the external AP when it is determined that the station function and the AP function can be performed concurrently.

BACKGROUND OF THE INVENTION Field of the Invention

The present invention relates to a communication technique in acommunication apparatus complying with a plurality of communicationschemes.

Description of the Related Art

In recent years, a technique of handover between communication schemesdifferent from each other which communicates by automatically switchingbetween two communication functions complying with the communicationschemes is used. For example, a communication apparatus transfersinformation for performing the setting of the second communicationscheme by using the first communication scheme and automaticallyexecutes the setting of the second communication scheme by using thatinformation. Note that the first communication scheme is, for example,infrared communication or NFC (Near Field Communication) and the secondcommunication scheme is, for example, a wireless LAN or Bluetooth® (seeJapanese Patent Laid-Open Nos. 2005-295574 and 2007-166538).

Even if the setting of the second communication scheme has beenperformed by using the first communication scheme, communication cannotbe finally performed in a case in which, for example, a function itselfof the second communication scheme is OFF. That is, for example, in acase in which a wireless LAN function is OFF in a communication partnerapparatus when the second communication scheme is the wireless LAN, itis impossible to finally communicate with the partner apparatus by thewireless LAN even if the communication apparatus performs the setting ofthe wireless LAN. In such a case, however, there exists no method forcoping with what kind of processing should be performed by thecommunication apparatus.

SUMMARY OF THE INVENTION

The present invention performs appropriate communication setting inaccordance with the state of a partner apparatus.

According to one aspect of the present invention, there is provided acommunication apparatus comprising: a first communication unitconfigured to perform short distance wireless communication; a secondcommunication unit configured to perform communication of a wirelessLAN; a start unit configured to start the short distance wirelesscommunication with another communication apparatus by the firstcommunication unit while the second communication unit is joining awireless LAN created by an external access point as a station of thewireless LAN; a determination unit configured to determine whether thecommunication apparatus can concurrently perform a station function andan access point function of the wireless LAN in accordance with a startof the short distance wireless communication by the start unit; a firstconnection unit configured to directly connect to the othercommunication apparatus by the wireless LAN by disconnecting from theexternal access point when the determination unit does not determinethat the station function and the access point function can beconcurrently performed; a reconnection unit configured to reconnect tothe external access point as the station of the wireless LAN when aconnection by the first connection unit fails; and a second connectionunit configured to directly connect to the other communication apparatusby the wireless LAN without disconnecting from the external access pointwhen the determination unit determines that the station function and theaccess point function can be concurrently performed.

Further features of the present invention will become apparent from thefollowing description of exemplary embodiments (with reference to theattached drawings).

BRIEF DESCRIPTION OF THE DRAWINGS

The accompanying drawings, which are incorporated in and constitute apart of the specification, illustrate embodiments of the invention, andtogether with the description, serve to explain the principles of theinvention.

FIG. 1 is a view showing an example of the arrangement of a wirelesscommunication system;

FIG. 2 is a block diagram showing an example of the hardware arrangementof a communication apparatus;

FIG. 3 is a block diagram showing an example of the functionalarrangement of the communication apparatus;

FIG. 4 is a sequence chart showing the first example of a processingsequence executed in the wireless communication system;

FIG. 5 is a flowchart showing the first example of a processing sequenceexecuted by a printer;

FIG. 6 is a sequence chart showing the second example of a processingsequence executed in the wireless communication system;

FIG. 7 is a flowchart showing an example of a processing sequenceexecuted by a mobile phone;

FIG. 8 is a sequence chart showing the third example of a processingsequence executed in a wireless communication system;

FIG. 9 is a flowchart showing the second example of a processingsequence executed by a printer;

FIG. 10 is a sequence chart showing the fourth example of a processingsequence executed in a wireless communication system;

FIG. 11 is a sequence chart showing the fifth example of a processingsequence executed in the wireless communication system; and

FIG. 12 is a flowchart showing the third example of a processingsequence executed by a printer.

DESCRIPTION OF THE EMBODIMENTS

An exemplary embodiment(s) of the present invention will now bedescribed in detail with reference to the drawings. It should be notedthat the relative arrangement of the components, the numericalexpressions and numerical values set forth in these embodiments do notlimit the scope of the present invention unless it is specificallystated otherwise.

First Embodiment

(Arrangement of Wireless Communication System)

FIG. 1 shows an example of the arrangement of a wireless communicationsystem according to this embodiment. The wireless communication systemincludes, for example, a printer 101, a mobile phone 102, and an accesspoint 103. Note that both of the printer 101 and the mobile phone 102function as communication apparatuses to be described later. The printer101 and the mobile phone 102 can communicate by using the firstcommunication scheme according to, for example, Near Field Communication(NFC) and the second communication scheme according to, for example, awireless LAN complying with the IEEE802.11 standard series. Note thatthe first communication scheme and the second communication scheme arenot limited to the communication schemes according to NFC and thewireless LAN, but may be a communication scheme related to anothercommunication standard or the like. Triggered by NFC communication, theprinter 101 and the mobile phone 102 can perform communication settingby the wireless LAN and can execute handover between the communicationschemes from NFC to the wireless LAN. Note that the access point 103 mayalso have the same function. At least one of the printer 101 and themobile phone 102 suffices to be able to perform processing to bedescribed below. One of the printer 101 and the mobile phone 102 mayonly have a general function of making the handover between thecommunication schemes executable. The wireless communication system mayalso include a communication apparatus other than three apparatusesshown in FIG. 1. Note that the printer or the mobile phone is merely anexample of the communication apparatus. The communication apparatus maybe a PC, a digital camera, a smart device, or the like.

In a description below, the access point 103 creates a wireless LANnetwork (infrastructure network), the printer 101 joins that network asa station, and the mobile phone 102 does not join that network.Furthermore, in the description below, the mobile phone 102 attempts tonewly connect to the printer 101 wirelessly and transmit held data tothe printer 101 for printing.

In this embodiment, the mobile phone 102 is made to come close to theprinter 101, thereby providing, via NFC, the printer 101 with settinginformation for communication between the printer 101 and the mobilephone 102 by using the wireless LAN. Then, the printer 101 can performthe setting of the wireless LAN based on that information, andestablish, by that setting, a connection with the mobile phone 102 inthe wireless LAN.

Note that there can be a case in which, for example, a wireless LANfunction of the mobile phone 102 is OFF. For example, a user of themobile phone 102 can turn off the wireless LAN manually in order toprevent battery consumption caused by searching for a surroundingwireless LAN unnecessarily. Further, there can be a case in which awireless LAN connection cannot be established when the userunintentionally moves the mobile phone 102 closer to the printer 101 orwhen a deficiency occurs in the write contents of an NFC tag by aninsufficient approaching time or the like. In this state, the printer101 cannot finally communicate with the mobile phone 102 by the wirelessLAN even if the setting of the connection to the mobile phone 102 by thewireless LAN has been performed. Conventionally, a study of what kind ofprocessing should be performed in such a case has not been made.

In this embodiment, considering this background, the printer 101determines, in accordance with the fact that it has communicated withthe mobile phone 102 by using NFC, whether it is possible to communicatewith the mobile phone 102 by the wireless LAN. If the determinationresult indicates that it is impossible to communicate with the mobilephone 102 by the wireless LAN, then the printer 101 does not perform thesetting of the connection to the mobile phone 102 or in case of afterthe setting, the printer 101 performs a process of automaticallyreturning to a setting before that setting. Similarly, the mobile phone102 determines, in accordance with the fact that it has communicatedwith the printer 101 by using NFC, whether it is possible to communicatewith the printer 101 by the wireless LAN. If the determination resultindicates that it is impossible to communicate with the printer 101 bythe wireless LAN, then the mobile phone 102 does not perform the settingof a connection to the printer 101 or in case of after the setting, themobile phone 102 performs a process of automatically returning to asetting before that setting.

The arrangement and the processing sequence of an apparatus whichperforms such processing will be described in detail below.

(Apparatus Arrangement)

FIG. 2 shows an example of the hardware arrangement of a communicationapparatus according to this embodiment. This communication apparatus isincluded in at least one of the printer 101 and the mobile phone 102,and may also be included in the access point 103. For example, thecommunication apparatus includes a control unit 201, a storage unit 202,a display unit 204, an operation unit 207, and a service providing unit208, and has a wireless LAN communication function and an NFCcommunication function. The wireless LAN communication functionincludes, for example, a wireless LAN communication unit 203, a wirelessLAN antenna control unit 205, and a wireless LAN antenna 206. The NFCcommunication function includes, for example, an NFC communication unit209, an NFC antenna control unit 210, and an NFC antenna 211.

The communication apparatus uses, as a communication scheme,communication schemes of Near Field Communication (NFC) and the wirelessLAN complying with the IEEE802.11 standard series. However, thecommunication apparatus may use a communication scheme other than these.For example, a wireless LAN complying with a standard other than theIEEE802.11 standard series may be used instead of the wireless LANcomplying with the IEEE802.11 standard series. Further, infraredcommunication or the like may be used instead of NFC. Furthermore, inthe wireless LAN complying with the IEEE802.11 standard series,communication in a direct communication mode such as Wi-Fi Direct® canbe performed besides communication in an infrastructure mode via theaccess point 103.

For example, the control unit 201 controls the entire communicationapparatus by executing control programs stored in the storage unit 202.The control unit 201 includes one or a plurality of processors such asCPUs or MPUs. Further, the control unit 201 can even control the settingof communication parameters with another communication apparatus. Thestorage unit 202 stores various kinds of information such as at leastone of the various control programs and communication parametersexecuted by the control unit 201. The storage unit 202 can also storeimage data, a file, or the like generated in the communication apparatusor received from an external apparatus. The storage unit 202 can beformed by, for example, an arbitrary medium such as a ROM (Read OnlyMemory), a RAM (Random Access Memory), an HDD (Hard Disk Drive), or aflash memory. Note that various operations of the communicationapparatus to be described later can be performed by causing the controlunit 201 to execute the control programs stored in the storage unit 202or, in some cases, may be performed by dedicated hardware suitable forthose operations.

The display unit 204 has at least one of a function of outputtingvisually perceivable information like an LCD or an LED and a function ofoutputting aurally perceivable information like a loudspeaker, andperforms various display operations by this function. The operation unit207 is formed by, for example, various buttons or a touch panel andaccepts operations made by various inputs by the user. The serviceproviding unit 208 provides various services of an application levelincluded in the communication apparatus. For example, when thecommunication apparatus is a printer, the service providing unit 208 isa printing unit, provides a printing function, and performs variouskinds of control for it. Further, for example, when the communicationapparatus is a digital camera, the service providing unit 208 is animage capturing unit, provides an image capturing function, and performsvarious kinds of control for it. Note that when the communicationapparatus provides a plurality of services, one service providing unit208 may operate to provide the plurality of services or onecommunication apparatus may include the plurality of service providingunits 208 each providing at least one service.

The wireless LAN communication unit 203 performs wireless LANcommunication complying with the IEEE802.11 standard series. Thewireless LAN communication unit 203 can transmit or receive a signal forthe wireless LAN by causing the wireless LAN antenna control unit 205 tocontrol the wireless LAN antenna 206.

The NFC communication unit 209 performs short distance wirelesscommunication complying with a Near Field Communication (NFC) standard.In NFC, an NFC tag and an NFC reader/writer are included as NFC roles.However, the NFC communication unit 209 can operate with playing eitherrole. The NFC communication unit 209 can transmit or receive a signalfor NFC by causing the NFC antenna control unit 210 to control the NFCantenna 211.

Note that the communication apparatus may further include a componentother than the respective components described above or may not includeany of the components out of the respective components described above.For example, the communication apparatus may not include the displayunit 204 and may have a communication function by a cellularcommunication scheme when, for example, the communication apparatus isthe mobile phone.

The functional arrangement of the communication apparatus according tothis embodiment will now be described with reference to FIG. 3. Forexample, as its functional arrangement, the communication apparatus hasan NFC related function and a wireless LAN related function, andincludes a service control unit 304 and a data storage unit 310. The NFCrelated function includes, for example, an NFC control function 301, anNFC reader/writer unit 302, and an NFC tag update unit 303. The wirelessLAN related function includes, for example, a wireless LAN packetreception unit 305, a wireless LAN packet transmission unit 306, awireless LAN STA function control unit 307, a wireless LAN AP functioncontrol unit 308, and a wireless LAN topology control unit 309.

The NFC control function 301 controls various NFC functions based on NFCforum specifications. In NFC, the NFC tag and the NFC reader/writerexist as NFC roles. However, the NFC control function 301 can evencontrol either role. Based on an NFC communication standard, the NFCreader/writer unit 302 obtains information by reading it from a partnerapparatus which plays the role of the NFC tag or writes thatinformation. The NFC tag update unit 303 performs a process of writingcontents obtained by reading them using the NFC reader/writer unit 302in the NFC tag of a self apparatus.

Each of the wireless LAN packet reception unit 305 and the wireless LANpacket transmission unit 306 performs reception/transmission of a signalfrom/to the partner apparatus in the wireless LAN complying with theIEEE802.11 standard series. The wireless LAN STA function control unit307 provides an STA (station) function defined in the IEEE802.11standard series. The wireless LAN STA function control unit 307performs, for example, authentication/encryption processing when theself apparatus operates as the STA of the wireless LAN. The wireless LANAP function control unit 308 provides an AP (Access Point) functiondefined in the IEEE802.11 standard series. The wireless LAN AP functioncontrol unit 308 performs, for example, authentication/encryptionprocessing when the self apparatus operates as the AP of the wirelessLAN and management of the communication partner apparatus. Only one ofthe wireless LAN STA function control unit 307 and the wireless LAN APfunction control unit 308 may operate at certain time or both of themmay operate concurrently. The wireless LAN topology control unit 309controls the arrangement of the wireless LAN by controlling the wirelessLAN STA function control unit 307 and the wireless LAN AP functioncontrol unit 308.

The service control unit 304 controls a service in an application layer.The application layer here indicates a service providing layer in anupper layer of the fifth or higher layer in an OSI reference model. Thatis, the service control unit 304 performs control for providing theprinting function, an image streaming function, a file transferfunction, or the like. The data storage unit 310 can store and holdsoftware itself, and a wireless LAN parameter and various tables such asa DHCP address table and an ARP table.

Note that each function of FIG. 2 may be implemented by the software orthe hardware. Each function of FIG. 2 may also be implemented bycombining the hardware and the software. Respective functional blocks ofFIG. 2 have a mutual relationship. The example of the functionalarrangement in FIG. 2 is merely an example. The plurality of functionalblocks of FIG. 2 may be integrated to form one functional block or anyof the functional blocks may further be divided into a plurality offunctional blocks.

(Processing Sequence)

The processing sequence executed by each apparatus described above willnow be explained with reference to FIGS. 4 and 5. FIG. 4 is a sequencechart showing an example of the processing sequence executed in thewireless communication system. FIG. 5 is a flowchart showing an exampleof the processing sequence executed by the printer 101.

In this processing, assume that the printer 101 is in a state in whichthe printer 101 is joining the wireless LAN network generated by theaccess point 103 (that is, connecting to the access point 103) (F401).In this state, when the user of the mobile phone 102 moves the mobilephone 102 closer to the printer 101 (touches the printer 101 with themobile phone 102), communication by NFC is performed between the printer101 and the mobile phone 102 (F402 and step S501). As a result, the NFCreader/writer unit 302 of the mobile phone 102 writes information on themobile phone 102 in the NFC tag of the printer 101 by communicationaccording to an NFC standard (F403 and step S502).

Note that the written information can be information capable ofspecifying at least the mobile phone 102 and can be, for example,identification information capable of identifying the mobile phone 102such as the MAC address or the UUID of the mobile phone 102. Further,the written information includes a request requesting that thecommunication between the printer 101 and the mobile phone 102 by thewireless LAN is performed. Note that the written information may containa communication parameter (information such as SSID, an encryption key,an encryption scheme, an authentication key, or an authenticationscheme) for the printer 101 to connect to the mobile phone 102 by thewireless LAN or authentication information such as a PIN code. Thecommunication parameter here may be a communication parameter of awireless LAN created by the mobile phone 102 when the mobile phone 102has a wireless LAN access point function. On the other hand, thecommunication parameter here may be a communication parameter of awireless LAN to which the mobile phone 102 connects (joins) currentlywhen the mobile phone 102 does not have the wireless LAN access pointfunction. That is, the communication parameter here may be acommunication parameter of an external access point.

After that, the printer 101 confirms the information written in the NFCtag of the self apparatus by the mobile phone 102 (F404 and step S503).By this confirmation, the printer 101 can recognize that the mobilephone 102 requires creation of the wireless LAN network between theprinter 101 and the mobile phone 102.

Then, the printer 101 leaves the wireless LAN that it is joiningcurrently and is created by the access point 103. That is, the printer101 disconnects a connection to the access point 103 (F405 and stepS504). More specifically, the printer 101 transmits, to the access point103, a wireless packet including a connection release frame. After that,the printer 101 transmits, to the wireless LAN, a search request packetwhich contains the information (for example, the identificationinformation such as the MAC address) received from the mobile phone 102in F402 and waits for a search response from the mobile phone 102 (F406and step S505). Note that the search request packet is, for example, aprobe request and the search response is, for example, a probe response.Here, when the communication parameter such as the SSID is received fromthe mobile phone 102 by NFC, a search request packet that has designatedthe SSID may be transmitted. Alternatively, the mobile phone 102 may besearched by transmitting a search request packet which does not containthe information such as the MAC address received from the mobile phone102 and determining the match between the MAC address received from themobile phone 102 and an MAC address of the transmission source of thereceived search response.

Note that the printer 101 may determine whether the self apparatus canperform the AP function and the STA function of the wireless LANconcurrently before disconnecting from the access point 103 (after stepS503). That is, the printer 101 creates a new wireless LAN by the APfunction and determines whether it can communicate with the mobile phone102 in the created network while joining the wireless LAN created by theaccess point 103 with the STA function. Then, if the printer 101 canperform the AP function and the STA function of the wireless LANconcurrently, it may perform the subsequent processing (F406 and step5505) without disconnecting from the access point 103 (by omittingprocessing in F405 and step S504). On the other hand, if the printer 101cannot perform the AP function and the STA function of the wireless LANconcurrently, it can perform the subsequent processing (F406 and step5505) after disconnecting from the access point 103 (F405 and stepS504).

When the mobile phone 102 does not enable the wireless LAN function, itcannot recognize, even if the printer 101 transmits the search requestpacket to the wireless LAN (F406 and step S505), the search requestpacket and cannot return the search response. If the response is notreturned from the mobile phone 102 within a predetermined time (NO instep S505), timeout occurs (F407) and the printer 101 terminates searchprocessing. As a result, the printer 101 cannot establish thecommunication with the mobile phone 102 by the wireless LAN.

After the timeout occurs, the printer 101 transmits a connection requestto the access point 103 and resumes the connection to the access point103 connected before a NFC touch (F408). Note that when the printer 101attempts to communicate with the mobile phone 102 as the AP whileconnecting to the access point 103 as the STA, F405 is omitted,eliminating the need for reconnection processing by F407. Upon resumingthe connection to the access point 103, the printer 101 then writes theinformation written in the NFC tag of the self apparatus back to theinformation before changed by F403 (F409 and step S508). Note that thecontents of the NFC tag may be written back before resuming theconnection to the access point 103.

Note that if the response is returned from the mobile phone 102 withinthe predetermined time (YES in step S505), the printer 101 establishesthe connection with the mobile phone 102 by the wireless LAN (stepS506). Note that a connection between the printer 101 and the mobilephone 102 by the wireless LAN can be established by using, for example,a Wi-Fi Direct® protocol. Then, the printer 101 obtains data to beprinted from the mobile phone 102 and performs print processing (stepS507). Note that after the end of the print processing, the printer 101may disconnect from the mobile phone 102 by the wireless LAN, establishthe connection with the access point 103 again, and then return thecontents of the NFC tag to a state before NFC communication is performedin step S501.

Note that the printer 101 may determine whether the mobile phone 102 canperform communication by the wireless LAN not by whether there has beena response to a search signal but by, for example, the NFCcommunication. That is, the printer 101 can obtain, from the mobilephone 102, information on whether the communication function of thewireless LAN is in an enabled state or the like by the NFC communicationand can determine, based on that information, whether the mobile phone102 can perform the communication by the wireless LAN. In this case, ifthe mobile phone 102 cannot perform the communication by the wirelessLAN, the printer 101 need not perform even the setting of the wirelessLAN for searching for the mobile phone 102. Therefore, the processingbecomes simpler and convenience can be improved.

The printer 101 may search for the mobile phone 102 by the wireless LANin a setting based on the information obtained by the NFC communicationwith the mobile phone 102 without recording that information in the NFCtag immediately. Then, the printer 101 may write the obtainedinformation in the NFC tag only if the mobile phone 102 is found.

The printer 101 performs the above-described processing. However, themobile phone 102 can also perform the same processing. This will bedescribed with reference to FIGS. 6 and 7. FIG. 6 is a sequence chartshowing an example of the processing sequence executed in the wirelesscommunication system. FIG. 7 is a flowchart showing an example of theprocessing sequence executed by the mobile phone 102.

First, NFC communication between the NFC tag of the printer 101 and theNFC reader/writer of the mobile phone 102 is performed by moving themobile phone 102 closer to the printer 101 (F601 and step S701). At thistime, for example, the NFC reader/writer of the mobile phone 102provides information for identifying the mobile phone 102 andinformation indicating that the mobile phone 102 requests communicationwith the printer 101 by writing them in the NFC tag of the printer 101.

Upon detecting the completion of the NFC communication, the mobile phone102 then starts connection processing to the printer 101 by the wirelessLAN (F602 and step S702). This connection processing is performed, forexample, based on the information provided with the printer 101 by theNFC communication and by using the Wi-Fi Direct® protocol. After that,the mobile phone 102 searches for the printer 101 by the wireless LAN(F603 and step S703). Note that, for example, when the printer 101 doesnot enable the wireless LAN function after the NFC communication, themobile phone 102 never receives a response to the search from theprinter 101 within a predetermined period of time. In this case,therefore, timeout occurs in the mobile phone 102 (F604 and NO in stepS703).

If the timeout has occurred, the mobile phone 102 changes the setting ofthe wireless LAN back to a state before the NFC communication (F605 andstep S705). Then, if the mobile phone 102 has connected to anotherwireless LAN access point or a public network before the NFCcommunication of F601, it restores that connection state. On the otherhand, if the mobile phone 102 has received the response to the searchwithin the predetermined period of time (YES in step S703), itestablishes a connection by the wireless LAN and performs printprocessing (step S704).

Note that the mobile phone 102 may determine whether the printer 101 canperform communication by the wireless LAN not by whether there has beena response to a search signal but by, for example, the NFCcommunication. That is, the mobile phone 102 can obtain, from theprinter 101, information on whether the communication function of thewireless LAN is in an enabled state or the like by the NFC communicationand can determine, based on that information, whether the printer 101can perform the communication by the wireless LAN. In this case, if theprinter 101 cannot perform the communication by the wireless LAN, themobile phone 102 need not perform even the setting of the wireless LANfor searching for the printer 101. Therefore, the processing becomessimpler and convenience can be improved.

As described above, when a wireless LAN connection based on NFCinformation is not completed, it becomes possible to return the contentsof the NFC tag or the setting of the wireless LAN to the state beforethe NFC communication is performed and to disable the setting for thewireless LAN connection based on that NFC information. This also makesit possible to prevent unnecessary information from being kept stored inthe NFC tag.

Second Embodiment

In the first embodiment, the processing has been described in which theprinter 101 or the mobile phone 102 determines whether it is possible tocommunicate with the partner apparatus by the wireless LAN and if itdetermines that it is not possible, it changes the contents of the NFCtag or the setting of the wireless LAN back to the previous state, ordoes not perform that setting. In this embodiment, a mobile phone 102designates a service (process) desired to be performed by NFCcommunication and a printer 101 determines whether it can handle thatservice. If the printer 101 cannot provide that service, it does notperform a connection with the mobile phone 102 by a wireless LAN andreturns contents of an NFC tag to a state before the NFC communication.On the other hand, if the printer 101 can provide that service, itestablishes the connection with the mobile phone 102 by the wireless LANand provides the designated service. Note that the same processing as inthe first embodiment may be performed in establishing the wireless LAN.That is, the printer 101 or the mobile phone 102 may determine whetherit is possible to communicate with a partner apparatus by the wirelessLAN and if it determines that it is not possible, it changes thecontents of the NFC tag or the setting of the wireless LAN back to theprevious state, or does not perform that setting.

A processing sequence according to this embodiment will be describedbelow with reference to FIGS. 8 and 9. Note that a system arrangementand an apparatus arrangement are the same as in the first embodiment,and thus a description thereof will be omitted. FIG. 8 is a sequencechart showing an example of the processing sequence executed in awireless communication system. FIG. 9 is a flowchart showing an exampleof the processing sequence executed by the printer 101. Note thatprocessing in F801 to F803 of FIG. 8 and processing in steps S901 andS902 of FIG. 9 are the same as processing in F401 to F403 of FIG. 4 andprocessing in steps S501 and S502 of FIG. 5, respectively. Thus, adescription thereof will be omitted. However, information written in theNFC tag of the printer 101 by the mobile phone 102 in F803 and step S902contains information for the mobile phone 102 to designate a servicethat requires execution.

The printer 101 confirms the contents written from the mobile phone 102in the NFC tag of the printer 101 (F804 and step S903). The printer 101confirms the service designated by the mobile phone 102 and confirmswhether the printer 101 can execute that service. Note that here, theprinter 101 can provide a direct print service and confirms whether thedirect print service has been designated by the mobile phone 102 (stepS904). Note that confirmation may be made here not of whether theprinter 101 can execute the designated service but of whether, forexample, the service is a predetermined service that should establish adirect connection between the printer 101 and the mobile phone 102 bythe wireless LAN.

If the printer 101 confirms that the direct print service has beendesignated as a result of confirming the NFC tag (YES in step S904), itdisconnects from an access point 103 in a connection state (F805 andstep S905). Note that this disconnection processing is the sameprocessing as in F405 of FIG. 4 and step S504 of FIG. 5. If the printer101 can function as an AP and an STA concurrently, the disconnectionprocessing and reconnection processing (F809) to be described later maynot be performed as described above. After that, the printer 101performs connection processing with the mobile phone 102 by a Wi-FiDirect® (F806 and step S906) and performs print processing (F807 andstep S908). Note that the printer 101 can perform detection and waitprocessing of the mobile phone 102 after a connection in a wireless LANlink layer by the Wi-Fi Direct® is established (step S907). The printer101 may shift to F406 and step 5505 of FIGS. 4 and 5 after theprocessing of F805 and step S905, and may perform the subsequentprocessing in accordance with FIGS. 4 and 5. After the end of the printprocessing, the printer 101 then disconnects from the mobile phone 102by the wireless LAN (F808) and establishes the connection with theaccess point 103 again (F809). After that, the printer 101 returns thecontents of the NFC tag to a state before the NFC communication of F802is performed (F810).

On the other hand, if the direct print service has not been designatedas a result of confirming the NFC tag (NO in step S904), the printer 101does not establish communication with the mobile phone 102 by thewireless LAN. In this case, the printer 101 writes the informationwritten in the NFC tag of a self apparatus back to information beforechanged by F803 (step S909).

Note that, the printer 101 may determine, based on information obtainedby the NFC communication with the mobile phone 102, whether thedesignated service described above is the service that the printer 101can handle or the predetermined service without recording thatinformation in the NFC tag immediately, as described above. Then, theprinter 101 may write the obtained information in the NFC tag when thedesignated service is the service that it can handle or thepredetermined service by which the direct connection by the wireless LANis required.

As described above, the printer 101 refers to the information obtainedfrom the mobile phone 102 by the NFC communication and determineswhether the service executable by itself has been designated or thepredetermined service that should establish the direct connection withthe mobile phone 102 by the wireless LAN has been designated. Then, theprinter 101 attempts to establish the direct connection with the mobilephone 102 by the wireless LAN when the service executable by itself hasbeen designated or when the predetermined service that should establishthe direct connection with the mobile phone 102 by the wireless LAN hasbeen designated. This makes it possible to return the contents of theNFC tag or the setting of the wireless LAN to the state before the NFCcommunication is performed and to disable the setting for the wirelessLAN connection based on that NFC information when the setting of thewireless LAN need not be performed. This also makes it possible toprevent unnecessary information from being kept stored in the NFC tag.

Third Embodiment

In this embodiment, a printer 101 confirms, based on informationobtained from a mobile phone 102 by NFC communication, whether themobile phone 102 currently connects to a wireless LAN to which theprinter 101 connects. That is, the printer 101 confirms whether themobile phone 102 has established a connection, by the wireless LAN, withan access point 103 to which the printer 101 connects. Then, the printer101 performs connection processing with the mobile phone 102 by thewireless LAN when the mobile phone 102 has not established theconnection with the access point 103. On the other hand, the printer 101communicates with the mobile phone 102 by communication by the wirelessLAN via the access point 103 when the mobile phone 102 has establishedthe connection with the access point 103.

A processing sequence according to this embodiment will be describedbelow with reference to FIGS. 10, 11, and 12. Note that a systemarrangement and an apparatus arrangement are the same as in the firstand second embodiments, and thus a description thereof will be omitted.Each of FIGS. 10 and 11 is a sequence chart showing an example of theprocessing sequence executed in a wireless communication system. FIG. 12is a flowchart showing an example of the processing sequence executed bythe printer 101.

First, the example of FIG. 10 will be described with reference to FIGS.10 and 12. The example of FIG. 10 is an example in which initially, eachof the printer 101 and the mobile phone 102 has already established theconnection with the access point 103 (F1001 and F1002). First,processing until the mobile phone 102 approaches the printer 101, theNFC communication is performed, and the information obtained by theprinter 101 is confirmed (F1003 to F1005 and steps S1201 to S1203) isthe same as in the first and second embodiments. Thus, a detaileddescription thereof will be omitted.

Subsequently, based on information written in an NFC tag, the printer101 determines, by using service search processing of a layer 3, whetherthe mobile phone 102 currently connects to a network to which theprinter 101 is joined (F1006 and step S1204). Note that the servicesearch processing of the layer 3 can be, for example, UPnP or MulticastDNS. More specifically, the printer 101 transmits a search request forsearching for the mobile phone 102 to a network to which it currentlyconnects (F1007). Upon receiving the search request from the printer101, the mobile phone 102 transmits a search response to the printer 101(F1008). This allows the printer 101 to find the mobile phone 102 by theservice search processing of the layer 3 (YES in step S1204).Subsequently, the printer 101 communicates with the mobile phone 102 andperforms print processing (F1009 and step S1207).

FIG. 10 represents that the search request and the search response aredirectly transmitted/received to/from the printer 101 and the mobilephone 102, for easy understanding. However, the present invention is notlimited to this. That is, the printer 101, in practice, transmits asearch request which has designated identification information (forexample, the MAC address) of the mobile phone 102 to the access point103 in order to determine whether the mobile phone 102 connects to theaccess point 103. The access point 103 receives this search request,transfers it to an STA connected to a wireless LAN created by itself,and transfers a response from each STA to the printer 101.Alternatively, identification information (for example, the MAC address)of the STA managed by the access point 103 is compared with theidentification information contained in the search request, and thatresult is transmitted to the printer 101. By those methods, the printer101 can certainly find the mobile phone 102 as long as the mobile phone102 has established the connection with the access point 103.

Similarly, FIG. 10 represents that the print processing is performeddirectly between the printer 101 and the mobile phone 102, for easyunderstanding. However, the present invention is not limited to this.That is, in this case, both of the printer 101 and the mobile phone 102exist under the control of the access point 103, and thus an actualpacket for printing may be transmitted/received via the access point103.

The example of FIG. 11 will now be described with reference to FIGS. 11and 12. The example of FIG. 11 is an example in which initially, whilethe printer 101 has already established the connection with each accesspoint 103 (F1101), the mobile phone 102 has not established theconnection with each access point 103. Processing until F1102 to F1104is the same as processing until F1103 to F1105 of FIG. 10, and thus adetailed description thereof will be omitted.

In the example of FIG. 11, the printer 101 determines, by using theservice search processing of the layer 3, that the mobile phone 102 doesnot currently connect to the network to which the printer 101 is joined(NO in step S1204). FIG. 11 does not show the search request and thesearch response shown in FIG. 10. In practice, however, processing isperformed in which the printer 101 transmits a search request but doesnot receive a search response because the mobile phone 102 does notconnect to the access point 103.

In this case, the printer 101 transmits a disconnection notification tothe access point 103 to disconnect from the access point 103 (F1106 andstep S1205), and attempts to establish the direct connection with themobile phone 102. Note that this disconnection processing is the same asthe processing in F405 of FIG. 4 and in step S504 of FIG. 5. If theprinter 101 can function as an AP and an STA concurrently, thedisconnection processing and reconnection processing to be describedlater may not be performed as described above. After that, the printer101 performs connection processing with the mobile phone 102 by a Wi-FiDirect® (F1107 and step S1206) and performs print processing (F1108 andstep S1207).

Note that the printer 101 may shift to F406 and step S505 of FIGS. 4 and5 after the processing of F1106 and step S1205, and may perform thesubsequent processing in accordance with FIGS. 4 and 5. After the end ofthe print processing, the printer 101 disconnects from the mobile phone102 by the wireless LAN, establishes the connection with the accesspoint 103 again, and then returns the contents of the NFC tag to a statebefore the NFC communication in step S1201 is performed.

Note that the printer 101 may determine, based on information obtainedby the NFC communication with the mobile phone 102, whether the mobilephone 102 connects to the access point 103 without recording thatinformation in the NFC tag immediately, as described above. Then, theprinter 101 may write the obtained information in the NFC tag when themobile phone 102 connects to the access point 103.

As described above, the printer 101 refers to the information obtainedfrom the mobile phone 102 by the NFC communication and determineswhether the mobile phone 102 connects to a network to which the printer101 connects (that is, the printer 101 connects to the access point103). Then, the printer 101 performs a process of establishing theconnection with the mobile phone 102 by the wireless LAN if it confirmsthat the mobile phone 102 has not established the connection with theaccess point 103. This makes it possible to return the contents of theNFC tag or the setting of the wireless LAN to the state before the NFCcommunication is performed and to disable the setting for the wirelessLAN connection based on that NFC information when the setting of thewireless LAN need not be performed again. This also makes it possible toprevent unnecessary information from being kept stored in the NFC tag.

According to the present invention, appropriate communication settingcan be performed in accordance with the state of a partner apparatus.

Other Embodiments

Embodiment(s) of the present invention can also be realized by acomputer of a system or apparatus that reads out and executes computerexecutable instructions (e.g., one or more programs) recorded on astorage medium (which may also be referred to more fully as a‘non-transitory computer-readable storage medium’) to perform thefunctions of one or more of the above-described embodiment(s) and/orthat includes one or more circuits (e.g., application specificintegrated circuit (ASIC)) for performing the functions of one or moreof the above-described embodiment(s), and by a method performed by thecomputer of the system or apparatus by, for example, reading out andexecuting the computer executable instructions from the storage mediumto perform the functions of one or more of the above-describedembodiment(s) and/or controlling the one or more circuits to perform thefunctions of one or more of the above-described embodiment(s). Thecomputer may comprise one or more processors (e.g., central processingunit (CPU), micro processing unit (MPU)) and may include a network ofseparate computers or separate processors to read out and execute thecomputer executable instructions. The computer executable instructionsmay be provided to the computer, for example, from a network or thestorage medium. The storage medium may include, for example, one or moreof a hard disk, a random-access memory (RAM), a read only memory (ROM),a storage of distributed computing systems, an optical disk (such as acompact disc (CD), digital versatile disc (DVD), or Blu-ray Disc (BD)™),a flash memory device, a memory card, and the like.

While the present invention has been described with reference toexemplary embodiments, it is to be understood that the invention is notlimited to the disclosed exemplary embodiments. The scope of thefollowing claims is to be accorded the broadest interpretation so as toencompass all such modifications and equivalent structures andfunctions.

This application claims the benefit of Japanese Patent Application No.2015-114156, filed Jun. 4, 2015 which is hereby incorporated byreference herein in its entirety.

1-9. (canceled)
 10. A communication apparatus comprising: one or moreprocessors; and a memory including instructions that, when executed bythe one or more processors, cause the communication apparatus tofunction as: a first communication unit configured to perform shortdistance wireless communication; a second communication unit configuredto perform communication of a wireless local area network (LAN); a startunit configured to start the short distance wireless communication withanother communication apparatus by the first communication unit in acase where the communication apparatus has joined a wireless LAN createdby an external access point, as a station of the wireless LAN; and acontrol unit configured to control, when the short distance wirelesscommunication with the another communication apparatus has been startedby the start unit, the communication apparatus to: perform, in a casewhere the communication apparatus and the another communicationapparatus are connected to an identical external access point, datacommunication by the second communication unit via the identicalexternal access point; disconnect a connection with the external accesspoint and perform direct data communication with the anothercommunication apparatus by the second communication unit, in a casewhere the communication apparatus and the another communicationapparatus are not connected to an identical external access point; andperform, in a case where the communication apparatus concurrentlyperforms a station function and an access point function, direct datacommunication with the another communication apparatus by the secondcommunication unit without disconnecting a connection with the externalaccess point even in a case where the communication apparatus and theanother communication apparatus are not connected to an identicalexternal access point.
 11. The apparatus according to claim 10, whereinthe control unit controls the communication apparatus to reconnect tothe external access point in a case where the direct data communicationwith disconnecting a connection with the external access point hasended.
 12. The apparatus according to claim 10, wherein determination ofwhether or not the communication apparatus and the another communicationapparatus are connected to an identical access point is performed by asearch process using a media access control (MAC) address.
 13. Theapparatus according to claim 10, wherein determination of whether or notthe communication apparatus and the another communication apparatus areconnected to an identical access point is performed based on informationcommunicated by the short distance wireless communication started by thestart unit.
 14. The apparatus according to claim 10, wherein thecommunication apparatus is a printer and the data communication is datacommunication for print processing.
 15. The apparatus according to claim10, wherein the direct data communication with the another communicationapparatus is performed in accordance with Wi-Fi Direct standard.
 16. Theapparatus according to claim 10, wherein the direct data communicationwith the another communication apparatus is performed by communicationusing an access point function of the communication apparatus.
 17. Theapparatus according to claim 10, wherein the wireless LAN is a wirelessLAN complying with an IEEE802.11 standard series.
 18. The apparatusaccording to claim 10, wherein the short distance wireless communicationis short distance wireless communication complying with a Near FieldCommunication (NFC) standard.
 19. A method for controlling acommunication apparatus which includes a first communication unitconfigured to perform short distance wireless communication and a secondcommunication unit configured to perform communication of a wirelesslocal area network (LAN), the method comprising: starting the shortdistance wireless communication with another communication apparatus bythe first communication unit in a case where the communication apparatushas joined a wireless LAN created by an external access point, as astation of the wireless LAN; and controlling, when the short distancewireless communication with the another communication apparatus has beenstarted, the communication apparatus to: perform, in a case where thecommunication apparatus and the another communication apparatus areconnected to an identical external access point, data communication bythe second communication unit via the identical external access point;disconnect a connection with the external access point and performdirect data communication with the another communication apparatus bythe second communication unit, in a case where the communicationapparatus and the another communication apparatus are not connected toan identical external access point; and perform, in a case where thecommunication apparatus concurrently performs a station function and anaccess point function, direct data communication with the anothercommunication apparatus by the second communication unit withoutdisconnecting a connection with the external access point even in a casewhere the communication apparatus and the another communicationapparatus are not connected to the identical external access point. 20.A non-transitory computer-readable storage medium storing a computerprogram for causing a computer which is included in a communicationapparatus including a first communication unit configured to performshort distance wireless communication and a second communication unitconfigured to perform communication of a wireless local area network(LAN) to: start the short distance wireless communication with anothercommunication apparatus by the first communication unit in a case wherethe communication apparatus has joined a wireless LAN created by anexternal access point, as a station of the wireless LAN; and control,when the short distance wireless communication with the anothercommunication apparatus has been started, the communication apparatusto: perform, in a case where the communication apparatus and the anothercommunication apparatus are connected to an identical external accesspoint, data communication by the second communication unit via theidentical external access point; disconnect a connection with theexternal access point and perform direct data communication with theanother communication apparatus by the second communication unit, in acase where the communication apparatus and the another communicationapparatus are not connected to an identical external access point; andperform, in a case where the communication apparatus concurrentlyperforms a station function and an access point function, direct datacommunication with the another communication apparatus by the secondcommunication unit without disconnecting a connection with the externalaccess point even in a case where the communication apparatus and theanother communication apparatus are not connected to an identicalexternal access point.